<!DOCTYPE HTML>
<html>
<head>
    <title>安置帮教安置页面</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <script src="/webjars/miniui/boot.js" type="text/javascript"></script>
    <link href="/static/css/resource.css" rel="stylesheet" type="text/css" />
    <link href="/static/css/default.css" rel="stylesheet" type="text/css" />
    <script src="/static/js/common/common.js" type="text/javascript"></script>
</head>
<style>
    .delBtn {
        border:1px solid #ff2120;
        border-radius:10px;
        font-size:8px;
        line-height:20px;
        font-weight:bold;
        color:#ff4634;
    }
    .editBtn {
        border:1px solid #018d00;
        border-radius:10px;
        font-size:8px;
        line-height:20px;
        font-weight:bold;
        color:#00a60a;
    }
</style>
<body>
<div class="mini-fit">
    <#--罪犯编号-->
    <input id="priNum" name="priNum" class="mini-hidden" value="${priNum}" />
    <div style="height: 100%;width: 86%;margin: 0 0 0 12%;overflow-x: auto;overflow-y: auto;padding: 10px;">
        <div id="editform" class="form" style="padding:10px;">
            <span style="font-size: 20px">${prisonerBaseInfo.pname!''}&emsp;&emsp;</span>/<span
                    style="font-size: 15px">${prisonerBaseInfo.sex!''}</span>
        </div>
        <div id="editform2" class="form" style="padding:10px;">
            <table class="form-table" width="100%">
                <tr style="line-height: 30px;">
                    <td width="40%"><span>身份证号:</span>${prisonerBaseInfo.idnum!''}
                    </td>
                    <td><span>出生日期:</span>${prisonerBaseInfo.age!''}
                    </td>
                </tr>
                <tr style="line-height: 30px;">
                    <td width="40%">
                        <span id="default">户籍地址:${prisonerBaseInfo.hjdz!''}</span>
                        <span id="otherhjdz"></span>
                    </td>
                    <td><span id="jzdz1">居住地址:</span>${prisonerBaseInfo.jzdz!'无'}
                    </td>
                </tr>
            </table>
        </div>
        <div id="editform3" class="form" style="padding:10px;">
            <span style="font-size: 18px">安置信息&emsp;&emsp;&emsp;</span> <a class="mini-button mini-button-primary"
                                                                           onclick="addAzInfoData('${prisonerBaseInfo.priNum!''}')">新增</a>
        </div>
        <div>
            <#list azInfoList as info>
                <#if info_index gt 0>
                    <hr />
                </#if>
                <fieldset style="border-radius: 10px;">
                    <legend><span style="font-size: 25px;"> </span></legend>
                    <div id="editform3" class="form" style="padding:10px;">
                        <table class="form-table" width="100%">
                            <tr style="line-height: 20px;">
                                <td width="30%"><span style="color: #8B8B8B">安置时间:&emsp;</span>${info.aztime!''}
                                </td>
                                <td width="50%"><span style="color: #8B8B8B">安置方式:&emsp;</span>${info.azfs!''}
                                </td>
                                <td width="20%">
                                    <a class="mini-button mini-button-primary" onclick="editAzInfoData('${info.azId!''}')">编辑</a></br>
                                </td>
                            </tr>
                            <tr style="line-height: 20px;">
                                <td><span style="color: #8B8B8B">协助办理社会保险:&emsp;</span>${info.shbx!''}
                                </td>
                                <td><span style="color: #8B8B8B">备注:&emsp;</span>${info.remark!''}
                                </td>
                                <td><a class="mini-button mini-button-danger" onclick="delAzInfoData('${info.azId!''}')">删除</a>
                                </td>
                            </tr>
                        </table>
                    </div>
                </fieldset>
            </#list>
        </div>
    </div>
</div>

<script type="text/javascript">
    mini.parse();
    var ftab = 1;
    var priNumObj = mini.get("priNum");
    var address = "";
    var value = ${prisonerBaseInfo.priAddr!''};

    var width;
    if(${localCode}== "140000") {
        width = "100%"
    } else {
        width = "70%"
    }

    function refreshPage(action) {
        if (action == "close") {
            window.location.reload();
        }
    }

        function editAzInfoData(e) {
            var priNum = priNumObj.getValue();
            mini.open({
                url: "/azbj/azbjgl/azgzgl/view/toAddAzInfoTab?azId=" + e + "&priNum=" + priNum,
                title: "编辑-安置信息",
                width: width,
                height: "80%",
                allowDrag: true,
                allowResize: false,
                showCloseButton: true,
                onload: function () {
                },
                ondestroy: function (action) {
                    refreshPage(action);
                }
            });
        }

        function delAzInfoData(e) {
            mini.confirm("确定要删除吗？",
                "确定？",
                function (action) {
                    if (action == "ok") {
                        $.ajax({
                            url: "/azbj/azbjgl/azgzgl/view/delAzInfoAction",
                            type: "post",
                            data: {delId: e},
                            success: function (result) {
                                if (result.code == 1) {
                                    if (action == "ok") {
                                        refreshPage("close");
                                    }
                                } else if (result.code == 5599) {
                                    mini.alert(result.message);
                                } else {
                                    mini.alert("删除失败");
                                }
                            }
                        });
                    }
                });
        }

        //添加安置信息
        function addAzInfoData() {
            var priNum = priNumObj.getValue();
            mini.open({
                targetWindow: window.parent,
                url: "/azbj/azbjgl/azgzgl/view/toAddAzInfoTab?priNum=" + priNum,
                title: "新增-安置信息",
                width: width,
                height: "80%",
                allowDrag: true,
                allowResize: false,
                showCloseButton: true,
                onload: function () {
                },
                ondestroy: function (action) {
                    if (action == 'close') {
                        //点击取消/×号
                        var iframe = this.getIFrameEl();
                        //获取选中、编辑的结果
                        var data = iframe.contentWindow.GetData();
                        var taskId = data.taskId;
                        var priNum = data.priNum;
                        var id = data.id
                        $.ajax({
                            url: "/upload/downloadAppendixFile/deleteById?1=1&id=" + id + "&priNum=" + priNum + "&taskId=" + taskId,
                            type: 'get',
                            success: function (success) {
                            }
                        })
                    }
                    window.location.reload();
                }
            })
        }

</script>
</body>
</html>